import winrm


class WinRmUtil():
    win = None

    def __init__(self, ip, username, password):

        try:
            WinRmUtil.win = winrm.Session('http://%s:5985/wsman' % ip, auth=(username, password))

        except:
            raise Exception

    @staticmethod
    def getClient():
        if WinRmUtil.win is None:
            raise Exception()
        else:
            return WinRmUtil.win
